{% import "_includes/forms" as forms %}

{{ hiddenInput('defaultValue[locale]', craft.app.language) }}
{{ hiddenInput('min[locale]', craft.app.language) }}
{{ hiddenInput('max[locale]', craft.app.language) }}

{{ forms.textField({
    label: "Default Value"|t('app'),
    id: 'defaultValue',
    name: 'defaultValue[value]',
    value: field.defaultValue,
    size: 5,
    errors: field.getErrors('defaultValue')
}) }}

{{ forms.textField({
    label: "Min Value"|t('app'),
    id: 'min',
    name: 'min[value]',
    value: field.min,
    size: 5,
    errors: field.getErrors('min')
}) }}

{{ forms.textField({
    label: "Max Value"|t('app'),
    id: 'max',
    name: 'max[value]',
    value: field.max,
    size: 5,
    errors: field.getErrors('max')
}) }}

{{ forms.textField({
    label: "Decimal Points"|t('app'),
    id: 'decimals',
    name: 'decimals',
    value: field.decimals,
    size: 1,
    errors: field.getErrors('decimals')
}) }}

{{ forms.textField({
    label: "Size"|t('app'),
    id: 'size',
    name: 'size',
    value: field.size,
    size: 2,
    errors: field.getErrors('size')
}) }}

{{ forms.textField({
    label: "Prefix Text"|t('app'),
    instructions: "Text that should be shown before the input."|t('app'),
    id: 'prefix',
    name: 'prefix',
    value: field.prefix,
    errors: field.getErrors('prefix')
}) }}

{{ forms.textField({
    label: "Suffix Text"|t('app'),
    instructions: "Text that should be shown after the input."|t('app'),
    id: 'suffix',
    name: 'suffix',
    value: field.suffix,
    errors: field.getErrors('suffix')
}) }}

{% set previewFormatInput %}
    <div class="flex">
        {{ forms.select({
            id: 'preview-format',
            name: 'previewFormat',
            options: [
                {label: 'As decimal numbers'|t('app'), value: 'decimal'},
                {label: 'As currency values'|t('app'), value: 'currency'},
                {label: 'Unformatted'|t('app'), value: 'none'},
            ],
            value: field.previewFormat,
            toggle: true,
            targetPrefix: 'preview-format-',
        }) }}
        <div id="preview-format-currency"{% if field.previewFormat != 'currency' %} class="hidden"{% endif %}>
            {{ forms.select({
                id: 'preview-currency',
                name: 'previewCurrency',
                size: 3,
                options: [
                    {label: 'Choose a currency…'|t('app'), value: ''},
                    {label: 'AFN', value: 'AFN'},
                    {label: 'EUR', value: 'EUR'},
                    {label: 'ALL', value: 'ALL'},
                    {label: 'DZD', value: 'DZD'},
                    {label: 'USD', value: 'USD'},
                    {label: 'AOA', value: 'AOA'},
                    {label: 'XCD', value: 'XCD'},
                    {label: 'ARS', value: 'ARS'},
                    {label: 'AMD', value: 'AMD'},
                    {label: 'AWG', value: 'AWG'},
                    {label: 'AUD', value: 'AUD'},
                    {label: 'AZN', value: 'AZN'},
                    {label: 'BSD', value: 'BSD'},
                    {label: 'BHD', value: 'BHD'},
                    {label: 'BDT', value: 'BDT'},
                    {label: 'BBD', value: 'BBD'},
                    {label: 'BYN', value: 'BYN'},
                    {label: 'BYR', value: 'BYR'},
                    {label: 'BZD', value: 'BZD'},
                    {label: 'XOF', value: 'XOF'},
                    {label: 'BMD', value: 'BMD'},
                    {label: 'INR', value: 'INR'},
                    {label: 'BTN', value: 'BTN'},
                    {label: 'BOB', value: 'BOB'},
                    {label: 'BOV', value: 'BOV'},
                    {label: 'BAM', value: 'BAM'},
                    {label: 'BWP', value: 'BWP'},
                    {label: 'NOK', value: 'NOK'},
                    {label: 'BRL', value: 'BRL'},
                    {label: 'BND', value: 'BND'},
                    {label: 'BGN', value: 'BGN'},
                    {label: 'BIF', value: 'BIF'},
                    {label: 'CVE', value: 'CVE'},
                    {label: 'KHR', value: 'KHR'},
                    {label: 'XAF', value: 'XAF'},
                    {label: 'CAD', value: 'CAD'},
                    {label: 'KYD', value: 'KYD'},
                    {label: 'CLP', value: 'CLP'},
                    {label: 'CLF', value: 'CLF'},
                    {label: 'CNY', value: 'CNY'},
                    {label: 'COP', value: 'COP'},
                    {label: 'COU', value: 'COU'},
                    {label: 'KMF', value: 'KMF'},
                    {label: 'CDF', value: 'CDF'},
                    {label: 'NZD', value: 'NZD'},
                    {label: 'CRC', value: 'CRC'},
                    {label: 'HRK', value: 'HRK'},
                    {label: 'CUP', value: 'CUP'},
                    {label: 'CUC', value: 'CUC'},
                    {label: 'ANG', value: 'ANG'},
                    {label: 'CZK', value: 'CZK'},
                    {label: 'DKK', value: 'DKK'},
                    {label: 'DJF', value: 'DJF'},
                    {label: 'DOP', value: 'DOP'},
                    {label: 'EGP', value: 'EGP'},
                    {label: 'SVC', value: 'SVC'},
                    {label: 'ERN', value: 'ERN'},
                    {label: 'ETB', value: 'ETB'},
                    {label: 'FKP', value: 'FKP'},
                    {label: 'FJD', value: 'FJD'},
                    {label: 'XPF', value: 'XPF'},
                    {label: 'GMD', value: 'GMD'},
                    {label: 'GEL', value: 'GEL'},
                    {label: 'GHS', value: 'GHS'},
                    {label: 'GIP', value: 'GIP'},
                    {label: 'GTQ', value: 'GTQ'},
                    {label: 'GBP', value: 'GBP'},
                    {label: 'GNF', value: 'GNF'},
                    {label: 'GYD', value: 'GYD'},
                    {label: 'HTG', value: 'HTG'},
                    {label: 'HNL', value: 'HNL'},
                    {label: 'HKD', value: 'HKD'},
                    {label: 'HUF', value: 'HUF'},
                    {label: 'ISK', value: 'ISK'},
                    {label: 'IDR', value: 'IDR'},
                    {label: 'XDR', value: 'XDR'},
                    {label: 'IRR', value: 'IRR'},
                    {label: 'IQD', value: 'IQD'},
                    {label: 'ILS', value: 'ILS'},
                    {label: 'JMD', value: 'JMD'},
                    {label: 'JPY', value: 'JPY'},
                    {label: 'JOD', value: 'JOD'},
                    {label: 'KZT', value: 'KZT'},
                    {label: 'KES', value: 'KES'},
                    {label: 'KPW', value: 'KPW'},
                    {label: 'KRW', value: 'KRW'},
                    {label: 'KWD', value: 'KWD'},
                    {label: 'KGS', value: 'KGS'},
                    {label: 'LAK', value: 'LAK'},
                    {label: 'LBP', value: 'LBP'},
                    {label: 'LSL', value: 'LSL'},
                    {label: 'ZAR', value: 'ZAR'},
                    {label: 'LRD', value: 'LRD'},
                    {label: 'LYD', value: 'LYD'},
                    {label: 'CHF', value: 'CHF'},
                    {label: 'MOP', value: 'MOP'},
                    {label: 'MKD', value: 'MKD'},
                    {label: 'MGA', value: 'MGA'},
                    {label: 'MWK', value: 'MWK'},
                    {label: 'MYR', value: 'MYR'},
                    {label: 'MVR', value: 'MVR'},
                    {label: 'MRO', value: 'MRO'},
                    {label: 'MUR', value: 'MUR'},
                    {label: 'XUA', value: 'XUA'},
                    {label: 'MXN', value: 'MXN'},
                    {label: 'MXV', value: 'MXV'},
                    {label: 'MDL', value: 'MDL'},
                    {label: 'MNT', value: 'MNT'},
                    {label: 'MAD', value: 'MAD'},
                    {label: 'MZN', value: 'MZN'},
                    {label: 'MMK', value: 'MMK'},
                    {label: 'NAD', value: 'NAD'},
                    {label: 'NPR', value: 'NPR'},
                    {label: 'NIO', value: 'NIO'},
                    {label: 'NGN', value: 'NGN'},
                    {label: 'OMR', value: 'OMR'},
                    {label: 'PKR', value: 'PKR'},
                    {label: 'PAB', value: 'PAB'},
                    {label: 'PGK', value: 'PGK'},
                    {label: 'PYG', value: 'PYG'},
                    {label: 'PEN', value: 'PEN'},
                    {label: 'PHP', value: 'PHP'},
                    {label: 'PLN', value: 'PLN'},
                    {label: 'QAR', value: 'QAR'},
                    {label: 'RON', value: 'RON'},
                    {label: 'RUB', value: 'RUB'},
                    {label: 'RWF', value: 'RWF'},
                    {label: 'SHP', value: 'SHP'},
                    {label: 'WST', value: 'WST'},
                    {label: 'STD', value: 'STD'},
                    {label: 'SAR', value: 'SAR'},
                    {label: 'RSD', value: 'RSD'},
                    {label: 'SCR', value: 'SCR'},
                    {label: 'SLL', value: 'SLL'},
                    {label: 'SGD', value: 'SGD'},
                    {label: 'XSU', value: 'XSU'},
                    {label: 'SBD', value: 'SBD'},
                    {label: 'SOS', value: 'SOS'},
                    {label: 'SSP', value: 'SSP'},
                    {label: 'LKR', value: 'LKR'},
                    {label: 'SDG', value: 'SDG'},
                    {label: 'SRD', value: 'SRD'},
                    {label: 'SZL', value: 'SZL'},
                    {label: 'SEK', value: 'SEK'},
                    {label: 'CHE', value: 'CHE'},
                    {label: 'CHW', value: 'CHW'},
                    {label: 'SYP', value: 'SYP'},
                    {label: 'TWD', value: 'TWD'},
                    {label: 'TJS', value: 'TJS'},
                    {label: 'TZS', value: 'TZS'},
                    {label: 'THB', value: 'THB'},
                    {label: 'TOP', value: 'TOP'},
                    {label: 'TTD', value: 'TTD'},
                    {label: 'TND', value: 'TND'},
                    {label: 'TRY', value: 'TRY'},
                    {label: 'TMT', value: 'TMT'},
                    {label: 'UGX', value: 'UGX'},
                    {label: 'UAH', value: 'UAH'},
                    {label: 'AED', value: 'AED'},
                    {label: 'USN', value: 'USN'},
                    {label: 'UYU', value: 'UYU'},
                    {label: 'UYI', value: 'UYI'},
                    {label: 'UZS', value: 'UZS'},
                    {label: 'VUV', value: 'VUV'},
                    {label: 'VEF', value: 'VEF'},
                    {label: 'VND', value: 'VND'},
                    {label: 'YER', value: 'YER'},
                    {label: 'ZMW', value: 'ZMW'},
                    {label: 'ZWL', value: 'ZWL'},
                    {label: 'XBA', value: 'XBA'},
                    {label: 'XBB', value: 'XBB'},
                    {label: 'XBC', value: 'XBC'},
                    {label: 'XBD', value: 'XBD'},
                    {label: 'XTS', value: 'XTS'},
                    {label: 'XAU', value: 'XAU'},
                    {label: 'XPD', value: 'XPD'},
                    {label: 'XPT', value: 'XPT'},
                    {label: 'XAG', value: 'XAG'},
                ],
                value: field.previewCurrency,
            }) }}
        </div>
    </div>
{% endset %}

<hr>

{{ forms.field({
    id: 'preview-format',
    label: 'Preview Format'|t('app'),
    instructions: 'How field values will be formatted within element indexes.'|t('app'),
    errors: field.getErrors('previewFormat')|merge(field.getErrors('previewCurrency')),
}, previewFormatInput) }}
